<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 构造函数的语法糖
        class Person{
            //属性  为 Person 的实例对象添加属性
            name='人类';
            age=30;
            run=function(){

            }

            say=() => {

            }

            learn = () => {
                console.log('我可以线上学习...');
            }

            //方法
            learn(){
                console.log('我可以学习....');
            }

            //构造方法  作用: 初始化对象    实例对象调用构造方法
            constructor(name, age){
                // this 永远都指向实例对象
                this.name = name;
                this.age = age;
            }
        }

        //继承
        class Student extends Person{
            constructor(name, age, height, weight){
                //如果子类有构造方法, 则必须要调用 super 函数
                super(name, age);// 简化操作 Person.call(this, ...);
                this.height = height;
                this.weight = weight;
            }
        }

        //实例化对象
        // let me = new Person('xiaohigh', 35);

        // console.log(me);
        // me.learn();

        let me = new Student('xiaohigh', 35, 180, 150);

        console.log(me);


    </script>
</body>
</html>